package com.sgcc.fj.pmos.e_fj_mall.activity;

import android.view.View;
import android.widget.RelativeLayout;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.sgcc.fj.pmos.arouter.mall.MallArouterPath;
import com.sgcc.fj.pmos.common.base.MvpBaseRecycleActivity;
import com.sgcc.pmos.nativesdk.R;
import com.sgcc.fj.pmos.e_fj_mall.adapter.DaypartingNoContractEleAdapter;
import com.sgcc.fj.pmos.e_fj_mall.contract.DaypartingNoContractEleContract;
import com.sgcc.fj.pmos.e_fj_mall.presenter.DaypartingNoContractElePresenter;

import java.util.ArrayList;
import java.util.List;

/**
 * 分时段不约定电量----设置电量比例
 */
@Route(path = MallArouterPath.MALL_DAYPARTINGNOCONTRACTELE)
public class DaypartingNoContractEleActivity extends MvpBaseRecycleActivity<String, DaypartingNoContractElePresenter> implements DaypartingNoContractEleContract.View {

    private RelativeLayout mRlLeft;
    private RelativeLayout mRlRight;

    @Override
    public void querySuccess() {

    }

    @Override
    public void queryFailed() {

    }

    @Override
    public String getTitleText() {
        return "设置电量比例";
    }

    @Override
    protected DaypartingNoContractElePresenter createPresenter() {
        return new DaypartingNoContractElePresenter();
    }

    @Override
    public BaseQuickAdapter getAdapter() {
        return new DaypartingNoContractEleAdapter();
    }

    @Override
    protected void initViews() {
        super.initViews();
        title_bar.setRightIcon(R.mipmap.go_main, new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                goMainActivity();
            }
        });

        refreshLayout.setEnablePureScrollMode(true);
    }

    @Override
    public void getDataRequest(int listSize, boolean isloading) {
        super.getDataRequest(listSize, isloading);
//        mPresenter.getCollectionList(listSize, isloading);

        List<String> list = new ArrayList<>();
        for (int i = 1; i < 25; i++) {
            list.add(i + "");
        }
        loadSuccess(false, list);
    }


    @Override
    public View getHeaderLayout(RelativeLayout parent) {
        View head_view = getLayoutInflater().inflate(R.layout.head_daypartingnocontractele_layout, parent, false);
        findHeadViewByIds(head_view);
        return head_view;
    }

    private void findHeadViewByIds(View head_view) {
    }

    @Override
    public View getFooterLayout(RelativeLayout parent) {
        View footer_view = getLayoutInflater().inflate(R.layout.footer_daypartingnocontractele_layout, parent, false);
        findFooterViewByIds(footer_view);
        return footer_view;
    }

    private void findFooterViewByIds(View footer_view) {
        mRlLeft = (RelativeLayout) footer_view.findViewById(R.id.rl_left);
        mRlRight = (RelativeLayout) footer_view.findViewById(R.id.rl_right);

        mRlLeft.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ARouter.getInstance()
                        .build( MallArouterPath.MALL_AUTOCURVESETTING)
                        .navigation();
            }
        });
    }
}
